import { Button } from "@/components/ui/button"; import { Pencil, Archive, Trash, Pause, Play, ChevronDown } from "lucide-react"; import { useUI } from "@/hooks/useUI"; import { useMemoriesApi } from "@/hooks/useMemoriesApi"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, DropdownMenuLabel, DropdownMenuSeparator, } from "@/components/ui/dropdown-menu"; interface MemoryActionsProps { memoryId: string; memoryContent: string; memoryState: string; } export function MemoryActions({ memoryId, memoryContent, memoryState, }: MemoryActionsProps) { const { handleOpenUpdateMemoryDialog } = useUI(); const { updateMemoryState, isLoading } = useMemoriesApi(); const handleEdit = () => { handleOpenUpdateMemoryDialog(memoryId, memoryContent); }; const handleStateChange = (newState: string) => { updateMemoryState([memoryId], newState); }; const getStateLabel = () => { switch (memoryState) { case "archived": return "Archived"; case "paused": return "Paused"; default: return "Active"; } }; const getStateIcon = () => { switch (memoryState) { case "archived": return ; case "paused": return ; default: return ; } }; return (
Change State handleStateChange("active")} className="cursor-pointer flex items-center" disabled={memoryState === "active"} > Active handleStateChange("paused")} className="cursor-pointer flex items-center" disabled={memoryState === "paused"} > Pause handleStateChange("archived")} className="cursor-pointer flex items-center" disabled={memoryState === "archived"} > Archive
); }